<?php
class TestBuyGoodModel extends Model
{
    public $_table = 'test_buy_good';

    //插入
    public function Insert($insert_array = array())
    {
        if(!empty($insert_array))
        {
            $sql = "insert into ".$this->_table."(";

            $insert_val = "";
            foreach ($insert_array as $key => $value)
            {
                $sql .= "`".$key."`,";

                $insert_val .= "'".$value."',";
            }
            $sql = rtrim($sql,',');

            $insert_val = rtrim($insert_val,',');

            $sql = $sql.") value (".$insert_val.")";

            return self::getInstance()->db()->exec($sql);

        }else
        {
            return null;
        }
    }
}